package cn.csxw.openchina.ui.fragment.exerciseFragment;
import android.os.Bundle;
import android.support.annotation.Nullable;

import java.util.ArrayList;

import javax.inject.Inject;

import cn.csxw.openchina.base.BaseRecAdapter;
import cn.csxw.openchina.base.BaseRefreshFragment;

import cn.csxw.openchina.dagger2.component.DaggerExerciseDetailFragmentComponent;
import cn.csxw.openchina.dagger2.module.ExerciseDetailFragmentModule;
import cn.csxw.openchina.dagger2.presenter.ExerciseDetailFragmentPresenter;
import cn.csxw.openchina.entity.bean.PostBean;
import cn.csxw.openchina.ui.adapter.ExerciseDetailAdapter;
import cn.csxw.openchina.utils.Global;

/**
 * Created by User on 2017/1/16.
 */

public class ExerciseDetailFragment extends BaseRefreshFragment {
    @Inject
    ExerciseDetailFragmentPresenter mExerciseDetailFragmentPresenter;
    public ExerciseDetailAdapter mAdapter;
    private ArrayList<PostBean> mPostBeen;
    @Override
    protected BaseRecAdapter getAdapter() {
        mPostBeen = new ArrayList<>();
        if (mAdapter==null){
            mAdapter = new ExerciseDetailAdapter(mPostBeen);
        }
        return mAdapter;
    }

    @Override
    public void doRefresh() {

    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        DaggerExerciseDetailFragmentComponent.builder().exerciseDetailFragmentModule(
                new ExerciseDetailFragmentModule(this)).build().inject(this);
       mExerciseDetailFragmentPresenter.callNetWork("243072");
        Global.onNetworkStateListener(mExerciseDetailFragmentPresenter,this);

    }
}
